/*
 * @Author: tianbo 8592865+hanqifeitb@user.noreply.gitee.com
 * @Date: 2025-01-29 22:28:48
 * @LastEditors: error: error: git config user.name & please set dead value or install git && error: git config user.email & please set dead value or install git & please set dead value or install git
 * @LastEditTime: 2025-04-23 15:21:47
 * @FilePath: /nuxt-front/stores/User.js
 * @Description: 这是默认设置,请设置`customMade`, 打开koroFileHeader查看配置 进行设置: https://github.com/OBKoro1/koro1FileHeader/wiki/%E9%85%8D%E7%BD%AE
 */

// stores/user.js
import { defineStore } from 'pinia'
import { getCustomerApi } from '@/service/user'

export const useUserStore = defineStore('user', {
  state: () => ({
    registerUser: null,
    userInfo: null,
    personalDetailInfo: null,
    isLoggedIn: false,
    closeMask: false,
    hideVisble: true, //默认显示的忘记密码等入口
    saveRegisterInfo: {
      // rephone: 验证手机号 注册true/登录false
    },
    searchTitle: '',
  }),
  actions: {
    handleChangeVisable(enable) {
      this.hideVisble = enable
    },
    closeMaskOut(flag) {
      this.closeMask = flag
      console.log(this.closeMask)
    },
    login(user) {
      this.userInfo = user
      this.isLoggedIn = true
    },
    handleCommitRegisterUser(user) {
      this.registerUser = user
    },
    logout() {
      this.userInfo = null
      this.isLoggedIn = false
    },
  },
  persist: {
    storage: piniaPluginPersistedstate.localStorage(),
  },
})
